#include <stdio.h>
int main(){
    FILE *file;
    char  buffer[100];
    file=fopen("file.txt","w");
    if(file==NULL){
        printf("File not found\n");
        return 1;
    }
    fprintf(file,"Hello World\n");
    fclose(file);

    file=fopen("file.txt","r");
    if(file==NULL){
        printf("File not found\n");
        return 1;
    }

    while(fgets(buffer,sizeof(buffer),file)!=NULL){
        printf("%s",buffer);
    }

    fclose(file);

    file=fopen("file.txt","a");
    if(file==NULL){
        printf("File not found\n");
        return 1;
    }
    fprintf(file,"Hello World\n");
    fclose(file);

    file=fopen("file.txt","r");
    if(file==NULL){
        printf("File not found\n");
        return 1;
    }
    while (fgets(buffer,sizeof(buffer),file)!=NULL)
    {
        printf("%s",buffer);
    }
    fclose(file);
    return 0;
}